package util;

import com.alibaba.fastjson2.JSON;

import java.util.HashMap;
import java.util.Map;

public class StanderRES {
    public  enum Status {
        OK(200),
        FAILED(400);

        private int code;
        Status(int code) {
            this.code = code;
        }
        public int getCode() {
            return code;
        }
    }

    public static String RES(Status status,Object data) {
        Map<String, Object> res = new HashMap<>();
        res.put("status", JSON.toJSONString(status.getCode()));
        res.put("data", data);
        return JSON.toJSONString(res);
    }
}
